<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
	<?php
require_once("../conn/conn_db.php");   //包含数据库连接文件
if( $_POST["txt_comment"]!= "" )
{
    $uid = $_POST["txt_uid"];    
    $name = $_POST["txt_name"];      
    $header = $_POST["txt_header"];      
    $comment = $_POST["txt_comment"];
	$pid = $_POST["txt_pid"];
    $time = date('Y-m-d-h-m-s'); //发布日期
    
    $sql = "insert into comment (p_id,comment_info,u_id,u_name,u_header,c_time) values('$pid','$comment','$uid','$name','$header','$time')";
    $insert = $conn->query($sql); //执行SQL语句
    if($insert)                  //判断执行结果
    {
        echo "<script>alert('评论成功！');self.location='../main.php#showcases'</script>";
    }
    else
    {
        echo "<script>alert('评论失败请重试！');self.location='../main.php#showcases'</script>";
    }
}
else
{
    echo "<script>alert('请输入评论内容！');self.location='../main.php#showcases'</script>";
}
?>
</body>
</html>